package DataBaseQuery;

import java.util.ArrayList;

public abstract class View {
	String name = "";
	protected ArrayList<VariableReference> fields;
	public int getFieldIndex(String name) {
		int index = -1;
		for (int i = 0; i < fields.size(); i++) {
			if (fields.get(i).is(name)) {
				if (index != -1)
					return -1;
				else
					index = i;				
			}
		}
		return index;
	}
	public RegularView select(ArrayList<MyExpression> fieldsName)
	{
		return new RegularView();
	}
	public String getFieldName(String fullname)
	{
		int index = fullname.indexOf('.');
		if(index >= 0)
		{
			return fullname.substring(index+1);
		}
		
		return fullname;
	}
	
}
